package in.freshstart.java.training.loops;

public class ConvertDecimalToBinary {
	public static void main(String[] args) {
		int d = 15;
		int i = 0;
		int r[] = new int[100];
		System.out.println("Decimal number is " + d);
		while (d > 0) {
			r[i++] = d % 2;

			d = d / 2;
		}
		i--;
		System.out.print("Binary value is ");
		for (; i >= 0; i--)
			System.out.print(r[i]);
	}

}
